package com.ruoyi.hr.service.impl.salary;


import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.hr.domain.Authority;
import com.ruoyi.hr.mapper.salary.SpecialPersonRegisterMapper;
import com.ruoyi.hr.service.salary.SpecialPersonRegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class SpecialPersonRegisterServiceImpl implements SpecialPersonRegisterService {

    @Autowired
    SpecialPersonRegisterMapper specialPersonRegisterMapper;

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public List<Map<String, Object>> findData(List<Authority> authorities, Map map, int isAdmin) {
        return specialPersonRegisterMapper.findData(authorities, map, isAdmin);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public int add(Map map) {
        return specialPersonRegisterMapper.add(map);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public String getyhlb(String bcid) {
        return specialPersonRegisterMapper.getyhlb(bcid);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public String getpgid(Map map) {
        return specialPersonRegisterMapper.getpgid(map);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public Map<String, Object> findDataById(int id) {
        return specialPersonRegisterMapper.findDataById(id);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public int edit(Map map) {
        return specialPersonRegisterMapper.edit(map);
    }

    @DataSource(value = DataSourceType.SLAVE)
    @Override
    public int delete(String ids) {
        String[] ids1 = ids.split(",");
        int sum = 0;
        for(String id : ids1){
            sum += specialPersonRegisterMapper.delete(id);
        }
        return sum;
    }
}
